package com.google.gwt.sample.dynatablerf.client.views;

import java.util.Map;

import com.google.gwt.sample.dynatablerf.client.presenters.AbstractSearchDataPresenter.SearchDataDisplay;
import com.google.gwt.sample.dynatablerf.client.theme.GrifoTheme;
import com.google.gwt.user.client.Command;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.MenuBar;
import com.google.gwt.user.client.ui.MenuItem;
import com.google.web.bindery.requestfactory.shared.EntityProxy;

public abstract class AbstractListView<E extends EntityProxy> extends Composite
		implements SearchDataDisplay<E> {

	@Override
	public void populateSearchMenuOptions(Map<String, Command> menuItens) {
		if (menuItens != null) {
			MenuBar menu = GrifoTheme.getSearchOptionsMenu(getHasMenuItens()
					.getMenuBar());
			MenuItem menuItem = null;
			for (String string : menuItens.keySet()) {
				menuItem = GrifoTheme.getSearchOptionsItem(string,
						menuItens.get(string));
				menu.addItem(menuItem);
			}
		}

	}

}
